package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.victor.entity.city.CityIntroduce;
import com.victor.entity.city.CityIntroducePhoto;
import com.victor.entity.collection.Collections;
import com.victor.entity.comments.CommentPhoto;
import com.victor.entity.comments.Comments;
import com.victor.entity.praise.CityPraise;
import com.victor.entity.praise.CommentsPraise;

@Mapper
public interface CityDao {
	/**
	 * 查询全部城市  搜索  筛选省份
	 * @param search
	 * @param province
	 * @return
	 */
	List<CityIntroduce> selAll(String search, String province);
	/**
	 * 添加城市
	 * @param cityIntroduce
	 * @return
	 */
	boolean insertCity(CityIntroduce cityIntroduce);
	/**
	 * 根据id查询
	 * @param id
	 * @param uid 
	 * @return
	 */
	CityIntroduce selCityById(@Param("id")String id,@Param("uid") String uid);
	/**
	 * 修改城市
	 * @param city
	 * @return
	 */
	boolean updateCity(CityIntroduce city);
	/**
	 * 删除
	 * @param ids
	 * @return
	 */
	boolean deleteCity(@Param("ids")int[] ids);
	/**
	 * 删除评论
	 * @param id
	 * @return
	 */
	boolean deleteComments(String id);
	/**
	 * 删除图片
	 * @param gid
	 * @return
	 */
	boolean delPhoto(Integer cid);
	/**
	 * 添加图组图片
	 * @param cityIntroducePhoto
	 * @return
	 */
	boolean insertPhoto(CityIntroducePhoto cityIntroducePhoto);
	/**
	 * 根据type和pid查询是否收藏
	 * @param collections
	 * @return
	 */
	Collections selCollectionByTypeAndPid(@Param("pid")String pid,@Param("uid")String uid);
	/**
	 * 添加城市收藏
	 * @param collections
	 * @return
	 */
	boolean insertCollections(Collections collections);
	/**
	 * 删除收藏
	 * @param id
	 * @return
	 */
	boolean deleteCollection(Integer id);
	/**
	 * 更具cityid查询点赞
	 * @param cityid
	 * @return
	 */
	CityPraise selCityPraiseByCityId(String cityid,String uid);
	/**
	 * 添加城市点赞
	 * @param cityPraise
	 * @return
	 */
	boolean insertCityPraise(CityPraise cityPraise);
	/**
	 * 删除城市点赞
	 * @param id
	 * @return
	 */
	boolean deleteCityPraise(Integer id);
	/**
	 * 查询城市点赞数
	 * @param cityid
	 * @return
	 */
	String selCitypraiseCount(String cityid);
	/**
	 * 修改转发数
	 * @param cityid
	 * @return
	 */
	boolean updateForwardCount(String cityid);
	/**
	 * 是否收藏
	 * @param collections
	 * @return
	 */
	@Select({"select * from collections where table_name=#{table_name} and uid=#{uid}"})
	List<Collections> selIfCollections(Collections collections);
	/**
	 * 根据名称查询
	 * @param city
	 * @return
	 */
	@Select({"select * from c_cityintroduce where c_name like concat('%',#{name},'%')"})
	CityIntroduce selCityByName(@Param("name")String city);

}
